package cn.huanzi.qch.springbootmybatis.dingding;


import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author keven
 * @date 2023-02-09 11:44 上午
 * @Description
 */
@Component
@ConditionalOnExpression("${notify.dingtalk.enable:false}")
public class DingtalkNotifier  {

    private DingTalkMessageSender messageSender;

   /* protected DingtalkNotifier(InstanceRepository repository, DingTalkMessageSender messageSender) {
        super(repository);
        this.messageSender = messageSender;
    }

    *//**
     * 发送钉钉群机器人消息
     *
     * @param event
     * @param instance
     * @param content
     *//*
    @Override
    public void sendMessage(InstanceEvent event, Instance instance, String content) {
        String instanceName = instance.getRegistration().getName();
        String instanceId = event.getInstance().toString();
        String status = ((InstanceStatusChangedEvent) event).getStatusInfo().getStatus();
        String serviceUrl = instance.getRegistration().getServiceUrl();
        String dateTime = DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MS_PATTERN);
        String message = String.format(MessageTemplate.MONITOR_MARKDOWN_TEMPLATE_DINGTALK, instanceName, instanceId, status, content, serviceUrl, dateTime);
        this.messageSender.sendMarkdownMessage("监控消息", message);
    }*/

}
